import sys
import os
import os.path

current_dir = os.path.abspath(os.path.dirname(__file__))
sys.path.append(current_dir)
sys.path.append("..")
#import exceptions

class progressBar(object):
    def __init__(self,length=20, name = "percent"):
        self.length = length
        self.name = name
    def draw(self, percent):
        hashes = '#' * int(percent/100.0 * self.length)
        spaces = ' ' * (self.length - len(hashes))
        sys.stdout.write("\r%s: [%s] %d%%"%(self.name, hashes + spaces, percent))
        sys.stdout.flush()

class YamlFormatError(Exception):
    pass